# Contributor: Jean-Louis Fuchs <jean-louis.fuchs@adfinis-sygroup.ch>
# Contributor: omni <omni+alpine@hack.org>
# Maintainer: Celeste <cielesti@protonmail.com>
pkgname=unison
pkgver=2.53.5
pkgrel=0
# Note: unison breaks compatibility between minor (major.minor) versions.
_majorver=${pkgver%.*}  # x.y
pkgdesc="Efficient file-synchronization tool"
url="https://www.cis.upenn.edu/~bcpierce/unison/"
arch="all !riscv64 !loongarch64" # ocaml
license="GPL-3.0-or-later"
makedepends="ocaml linux-headers"
checkdepends="coreutils"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/bcpierce00/unison/archive/v$pkgver.tar.gz"

build() {
	make

	cp -v src/unison unison-text
	cp -v src/unison-fsmonitor unison-fsmonitor
}

check() {
	make test
}

package() {
	install -Dvm755 unison-text \
		"$pkgdir"/usr/bin/unison-text-$_majorver
	install -Dvm755 unison-fsmonitor \
		"$pkgdir"/usr/bin/unison-fsmonitor-$_majorver
	install -Dvm644 man/unison.1 \
		-t "$pkgdir"/usr/share/man/man1/

	cd "$pkgdir"/usr/bin
	ln -sv unison-text-$_majorver unison-text
	ln -sv unison-text unison
}

sha512sums="
eabeed7b428f1985610b47ce8bc7faac515fd24937727612aa45435da3e38d40b6cd6d227eb3b65dc370d46458cecfca9d0e9e1712b2b7fa41b76675f8115c4c  unison-2.53.5.tar.gz
"
